<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport"
        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>

</body>
<script>
  setInterval(function() {
    var surplusTime = new Date('2019-02-21') - new Date();
    surplusTime = Math.floor(surplusTime/1000);
    console.log(surplusTime)
    var days = surplusTime/(24*60*60);
  days = Math.floor(days);
  // var hours = surplusTime%(24*60*60)/3600;
    var hours = Math.floor(surplusTime%(24*60*60)/3600);
  //获取分钟，直接和小时取余
  var minutes = surplusTime%(60*60)/60;
  minutes = Math.floor(minutes);
  //获取秒钟，直接和60取余
  var seconds = surplusTime%60;
  console.log('距离报名开始时间'+days+'天'+hours+'时'+minutes+'分'+seconds+'秒哦');
  },1000)
</script>
</html>